/*
 *  Directions.cpp
 *  
 *	Version 1.0
 *  Created by Nicholas Blecha on 9/25/10.
 *  Copyright 2010 Michigan Technological University. All rights reserved.
 *
 */

#include "Directions.h"


void Directions::move(Sprite* toMove, int speed, Direction dir) {
	double diagonalMult = .3536;
	SDL_Rect* rect = toMove -> getRect();
	switch (dir) {
		case UP:
			rect->y -= speed;
			break;
		case LEFT:
			rect->x -= speed;
			break;
		case DOWN:
			rect->y += speed;
			break;
		case RIGHT:
			rect->x += speed;
			break;
		case UP_LEFT:
			rect->x -= (int) (speed*diagonalMult);
			rect->y -= (int) (speed*diagonalMult);
			break;
		case UP_RIGHT:
			rect->x += (int) (speed*diagonalMult);
			rect->y -= (int) (speed*diagonalMult);
			break;
		case DOWN_LEFT:
			rect->x -= (int) (speed*diagonalMult);
			rect->y += (int) (speed*diagonalMult);
			break;
		case DOWN_RIGHT:
			rect->x += (int) (speed*diagonalMult);
			rect->y += (int) (speed*diagonalMult);
			break;
	}
	
}